// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_pr.p_c;

import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
import com.nnee.p_pr.p_prov.cls_ac;
import com.nnee.p_pr.p_prov.r;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class cls_b
{

    public cls_b()
    {
    }

    public static String a(Context context, String s)
    {
        String s1 = null;
        if(context != null && s != null)
        {
            ContentResolver contentresolver = context.getContentResolver();
            android.net.Uri uri = r.i;
            String as[] = new String[1];
            as[0] = "path";
            String as1[] = new String[1];
            as1[0] = s;
            Cursor cursor = contentresolver.query(uri, as, "name=?", as1, s1);
            if(cursor != null)
            {
                if(cursor.moveToFirst())
                    s1 = cursor.getString(0);
                cursor.close();
            }
        }
        return s1;
    }

    public static List a(Context context)
    {
        String s = null;
        if(context != null)
        {
            Cursor cursor = context.getContentResolver().query(r.i, a, s, s, s);
            if(cursor != null && cursor.moveToFirst())
            {
                s = new LinkedList();
                do
                {
                    com.nnee.p_pr.p_atom.p_b.cls_b b1 = new com.nnee.p_pr.p_atom.p_b.cls_b();
                    b1.a(cursor.getString(1));
                    b1.b(cursor.getString(2));
                    b1.d(cursor.getString(3));
                    b1.e(cursor.getString(4));
                    b1.a(cursor.getLong(5));
                    b1.c(cursor.getString(6));
                    s.add(b1);
                } while(cursor.moveToNext());
                cursor.close();
            }
        }
        return s;
    }

    public static void a(Context context, String s, String s1)
    {
        if(context != null && s != null && s1 != null)
        {
            ContentValues contentvalues = new ContentValues();
            contentvalues.put("path", s1);
            ContentResolver contentresolver = context.getContentResolver();
            android.net.Uri uri = r.i;
            String as[] = new String[1];
            as[0] = s;
            contentresolver.update(uri, contentvalues, "name=?", as);
        }
    }

    public static void a(Context context, List list)
    {
        if(context == null || list == null || list.size() <= 0) goto _L2; else goto _L1
_L1:
        SQLiteDatabase sqlitedatabase;
        SQLiteStatement sqlitestatement;
        sqlitedatabase = ac.a(context).getWritableDatabase();
        sqlitedatabase.beginTransaction();
        sqlitestatement = null;
        StringBuilder stringbuilder = new StringBuilder();
        stringbuilder.append(" INSERT INTO ");
        stringbuilder.append("fonts");
        stringbuilder.append("(");
        stringbuilder.append("name");
        stringbuilder.append(",");
        stringbuilder.append("desc");
        stringbuilder.append(",");
        stringbuilder.append("len");
        stringbuilder.append(",");
        stringbuilder.append("md");
        stringbuilder.append(",");
        stringbuilder.append("url");
        stringbuilder.append(")");
        stringbuilder.append(" VALUES(");
        stringbuilder.append("?,?,?,?,?");
        stringbuilder.append(");");
        sqlitestatement = sqlitedatabase.compileStatement(stringbuilder.toString());
        for(Iterator iterator = list.iterator(); iterator.hasNext(); sqlitestatement.execute())
        {
            com.nnee.p_pr.p_atom.p_b.cls_b b1 = (com.nnee.p_pr.p_atom.cls_b.b)iterator.next();
            a(sqlitestatement, 1, b1.a());
            a(sqlitestatement, 2, b1.b());
            sqlitestatement.bindLong(3, b1.e());
            a(sqlitestatement, 4, b1.d());
            a(sqlitestatement, 5, b1.c());
        }

          goto _L3
        Exception exception1;
        exception1;
        exception1.printStackTrace();
        if(sqlitestatement != null)
            sqlitestatement.close();
        sqlitedatabase.endTransaction();
_L2:
        return;
_L3:
        sqlitedatabase.setTransactionSuccessful();
        if(sqlitestatement != null)
            sqlitestatement.close();
        sqlitedatabase.endTransaction();
          goto _L2
        Exception exception;
        exception;
        if(sqlitestatement != null)
            sqlitestatement.close();
        sqlitedatabase.endTransaction();
        throw exception;
    }

    private static void a(SQLiteStatement sqlitestatement, int i, String s)
    {
        if(s == null)
            sqlitestatement.bindNull(i);
        else
            sqlitestatement.bindString(i, s);
    }

    private static String a[];
    private static final int b = 1;
    private static final int c = 2;
    private static final int d = 3;
    private static final int e = 4;
    private static final int f = 5;
    private static final int g = 6;

    static 
    {
        String as[] = new String[7];
        as[0] = "_id";
        as[1] = "name";
        as[2] = "desc";
        as[3] = "md";
        as[4] = "path";
        as[5] = "len";
        as[6] = "url";
        a = as;
    }
}
